//
//  CDCategories.m
//  freeLance
//
//  Created by s.zalozniy on 3/29/13.
//  Copyright (c) 2013 Mozi Development. All rights reserved.
//

#import "CDCategories.h"
#import "CDCollections.h"


@implementation CDCategories

@dynamic ident;
@dynamic name;
@dynamic isSynchronized;
@dynamic collections;


#pragma mark - Allocators

+(CDCategories *) categoryWithCategoryInfo:(Categories *) categoryInfo inContext:(NSManagedObjectContext *)context{
    CDCategories *newCategory = [NSEntityDescription insertNewObjectForEntityForName:[[CDCategories class] description]
                                                              inManagedObjectContext:context];
    [newCategory updateWithCategoryInfo:categoryInfo inContext:context];
    
    return newCategory;
}


#pragma mark - Interface methods

-(void) updateWithCategoryInfo:(Categories *)categoryInfo inContext:(NSManagedObjectContext *)context {
    self.ident = categoryInfo.ident;
    self.name = categoryInfo.name;
    self.isSynchronized = [NSNumber numberWithBool:YES];
}

@end
